Skip to content

[WIP] Wii U memory map + .rpx hashing#515

Draft
Loloseiz wants to merge 3 commits into
RetroAchievements:developfrom
Loloseiz:wii-u-memory-map
Draft

[WIP] Wii U memory map + .rpx hashing#515
Loloseiz wants to merge 3 commits into
RetroAchievements:developfrom
Loloseiz:wii-u-memory-map

Conversation

@Loloseiz
Copy link
Copy Markdown

@Loloseiz Loloseiz commented May 5, 2026

I have mapped the Wii U virtual memory based on Cafe OS specifications and verified the bounds against Cemu's open-source allocator (coreinit_Memory.cpp).

  • MEM2 (2GB): 0x10000000 -> RC_MEMORY_TYPE_SYSTEM_RAM
  • MEM1 (32MB): 0xF4000000 -> RC_MEMORY_TYPE_VIRTUAL_RAM
  • Code/Heap (240MB): 0x01000000 -> RC_MEMORY_TYPE_READONLY

I saw Jamiras's previous concerns on the 3DS PR regarding the massive memory dumps, so I marked MEM1 as VIRTUAL_RAM and the Code segment as READONLY to restrict the default searchable pool strictly to the MEM2 block, not sure if much more can / needs to be done as of now.

I also implemented the ELF parser in hash_rom.c to identify and hash .rpx executables, along with custom unit tests.

Let me know if I should change something, I tried to follow the baseline set with previous functions and methods, hope this will be useful !

@Loloseiz Loloseiz marked this pull request as ready for review May 5, 2026 22:15
Copy link
Copy Markdown
Member

@Jamiras Jamiras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't feel like we're in a position to support Wii U at this time (or any time soon).

{ 0x90000000U, 0xF3FFFFFFU, 0x90000000U, RC_MEMORY_TYPE_UNUSED, "Unused" },
{ 0xF4000000U, 0xF5FFFFFFU, 0xF4000000U, RC_MEMORY_TYPE_VIRTUAL_RAM, "MEM1" }
};
static const rc_memory_regions_t rc_memory_regions_wii_u = { _rc_memory_regions_wii_u, 5 };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw Jamiras's previous concerns on the 3DS PR regarding the massive memory dumps, so I marked MEM1 as VIRTUAL_RAM and the Code segment as READONLY to restrict the default searchable pool strictly to the MEM2 block, not sure if much more can / needs to be done as of now.

Excluding the 32MB MEM1 while still including the 2048MB MEM2 doesn't really seem like it would help much. I've been very reluctant to proceed with the 3DS PR because it's trying to expose 1/3 as much memory as this PR does.

When a user presses "New Search", we ask the core/emulator for all the memory expected by the memory map. This gets saved in a snapshot so when the user presses "Filter", we can identify which memory values changed. With a 2GB+ initial snapshot, and large subsets of that for each step of filtering, the host system will very quickly run out of memory before the developer is able to find the data they're looking for.

Comment thread src/rhash/hash_rom.c Outdated
return rc_hash_iterator_buffer(hash, iterator);
}

int rc_hash_wiiu(char hash[33], const rc_hash_iterator_t* iterator)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually, this should be rc_hash_wiiu_rpx. Most users will expect support for wux files, and this function won't handle those.

Additionally, wux processing should be in hash_disc.c, so there shouldn't be a common function that tries to support both.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most users will expect support for wux files, and this function won't handle those.

Fully parsing WUD/WUX inside hash_disc.c would require rcheevos to implement Wii U AES decryption and manage proprietary keys files, which feels a bit out of scope (from what I understand)

Maybe we could bypass this and fully support .wux files without bloating this repo by letting Cemu handle the heavy lifting, since it already decrypts and extracts main.rpx into RAM. We could theoretically pass the buffer directly to rc_hash_generate_from_buffer() from there.

With that, rcheevos would only ever need to know how to hash a .rpx payload, no matter what file type was initially passed.

That being said, I understand that it's easier said than done, and may not fit what you envision for the project, but I just wanted to leave that there as an idea for future implementations.

Comment thread test/rhash/test_hash_rom.c
Comment thread test/rhash/test_hash_rom.c Outdated
@Loloseiz
Copy link
Copy Markdown
Author

I really don't feel like we're in a position to support Wii U at this time (or any time soon).

Yeah, I figured by looking at other parts of the project later on. I'll proceed with the requested changes and leave this PR as a Draft/reference. I hope it will be helpful when the team is ready to tackle this generation of consoles :)

@Loloseiz Loloseiz marked this pull request as draft May 18, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants